package Judge.Login.Controller;

import Judge.Login.View.*;
import Judge.Login.Model.*;
import Judge.Login.Controller.*;

import Judge.JudgeMainFrame.JudgeMainFrameView.*;
import Judge.JudgeMainFrame.JudgeMainFrameModel.*;
import Judge.JudgeMainFrame.JudgeMainFrameController.*;

public class JudgeLoginController 
{
    public void initialize()
    {
    	getView().exitButton.addActionListener(new ExitButtonListener(getView(), getModel()));
    	getView().loadFileButton.addActionListener(new LoadFileButtonListener(getView(), getModel()));
    	getView().loginButton.addActionListener(new LoginButtonListener(getView(), getModel(), this));
    }
    public void setViewAndModel(JudgeLoginView view, JudgeLoginModel model)
    {
    	this.view = view;
    	this.model = model;
    }
    
    public JudgeLoginView getView()
    {
        return this.view;
    }
    public JudgeLoginModel getModel()
    {
    	return this.model;
    }
    
    public void runMainFrame()
    {
    	getView().frame.setVisible(false);
    	JudgeMainFrameView judgeMainFrameView = new JudgeMainFrameView();
    	JudgeMainFrameModel judgeMainFrameModel = new JudgeMainFrameModel();
    	JudgeMainFrameController judgeMainFrameController = new JudgeMainFrameController();
    	judgeMainFrameModel.setViewAndController(judgeMainFrameView, judgeMainFrameController);
    	judgeMainFrameController.setViewAndModel(judgeMainFrameView, judgeMainFrameModel);
    	judgeMainFrameModel.innitialize();
    	judgeMainFrameController.initialize();
    }
    
    private JudgeLoginView view;
    private JudgeLoginModel model;
    private JudgeLoginController controller;
}
